package com.mypro._01base.test;

import com.mypro._01base.mapper.TeacherMapper;
import com.mypro._01base.dbutil.DbUtil;
import com.mypro._01base.mapper.Stumapper;
import org.apache.log4j.Logger;
import org.junit.jupiter.api.Test;

/**
 * @author user_xdd
 * @Date 2022-05-06 11:03
 * @description
 *   测试由中间表连接起来的两个表
 * @return
 */
public class StuAndTeacher {
        private static  final Logger LOGGER = Logger.getLogger(StuAndTeacher.class);

    @Test
    public void testStu(){
        Stumapper mapper = DbUtil.getSqlSession().getMapper(Stumapper.class);
        TeacherMapper teacherMapper = DbUtil.getSqlSession().getMapper(TeacherMapper.class);
        //================Stu======================
/*        List<Stu> stus = mapper.queryAll();
        for (Stu stu : stus) {
             LOGGER.debug("    stu:"+stu);
            List<Teacher> teacherList = stu.getTeacherList();
            for (Teacher teacher : teacherList) {
                System.out.println(teacher.toString());
            }
        }*/

        //===============teacher=======================
/*        List<Teacher> teachers = teacherMapper.queryAll();
        for (Teacher teacher : teachers) {
            System.out.println(teacher.toString());
            List<Stu> stuList = teacher.getStuList();
            for (Stu stu : stuList) {
                 LOGGER.debug("    stu:"+stu);
            }
        }*/


    }
}
